home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_496 / ruler / cli / ruler.c < prev   
C/C++ Source or Header  |  1992-05-06  |  17KB  |  689 lines

  1. /*    RULER - CLI version
  2.  *
  3.  *    See Ruler.doc for operating instructions
  4.  *
  5.  *    Revision History:
  6.  *    -----------------
  7.  *
  8.  *    Version 5.0   21-Apr-1991  ©1991 Dave Schreiber, Chad Netzer, and
  9.  *                     Thad Floryan
  10.  *        Based upon code from:
  11.  *
  12.  *    Version 4.0   29-Dec-1989  ©1989  Chad Netzer and Thad Floryan
  13.  *
  14.  *        Based upon code, idea, and logic from:
  15.  *
  16.  *    Version 1.0   7-Nov-1988   ©1988 Thad Floryan
  17.  *
  18.  *    Revision history:
  19.  *        21-April-1991 - (Ver. 5.00) (DKS):
  20.  *        1 Window is sized to make room for > 8 point fonts in the
  21.  *          title bar and main window (for compatibility with AmigaOS
  22.  *          2.x)
  23.  *        2 Added the ability to put Ruler's window on any screen at
  24.  *          will.
  25.  *        3 Added the ability to get the font scale from any window.
  26.  *        4 Added menus for:
  27.  *          * About
  28.  *          * Quit
  29.  *          * Change Screen (#2)
  30.  *          * Change Font (#3)
  31.  *          These menus are layed out by the 2.x function
  32.  *          LayoutMenusA().  This function is called only if Ruler
  33.  *          is running under 2.0 or later (i.e. Ruler is 1.3
  34.  *          compatible).
  35.  *
  36.  *        29-December-1989 - (Ver. 4.0) - Added an offset so that you can
  37.  *        just stick the window on the left edge of the workbench screen,
  38.  *        and it will automatically be lined up with the characters.
  39.  *        Fixed some more minor bugs and rearranged the code a bit.
  40.  *        Added ARP support for those who want it. (CFN)
  41.  *
  42.  *        09-March-1989 - (Ver. 3.1) - Fixed a visual bug so that scale can
  43.  *        no longer be less than eight. (CFN)
  44.  *
  45.  *        06-Dec-1988 - (Ver. 3.0) - Added support for measuring fonts of
  46.  *        varying widths (selectable scale). (CFN)
  47.  *
  48.  *        22-Nov-1988 - (Ver. 2.2) - More adjustments to code, No major
  49.  *        changes.  Program size is slightly smaller.  (CFN)
  50.  *
  51.  *        14-Nov-1988 - (Ver. 2.1) - Fixed a few minor (harmless) bugs.  The
  52.  *        right edge of the ruler is now always redrawn after resizing.
  53.  *        I got rid of that GOTO statement (which in 'C', is considered a
  54.  *        bug. :-)  Version 2.1 now lets you open a ruler to be as low as
  55.  *        12 characters wide, which 2.0 only advertised. (CFN)
  56.  *
  57.  *        13-Nov-1988 - (Ver. 2.0) - I added minor enhancements, most
  58.  *        noteably, the ability to resize the window, and support for
  59.  *        overscanned screens.    (CFN)
  60.  *
  61.  *
  62.  *    Feel welcome to use this program for any non-commercial purposes or
  63.  *    for your personal learning.  Commercial users are requested to contact
  64.  *    Thad at either:
  65.  *
  66.  *    UUCP:    thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad
  67.  *    BBS:    BBS-JC, 415/961-7250 (300/1200/2400), "Thad Floryan" | "SYSOP"
  68.  *
  69.  *    Chad at:
  70.  *
  71.  *    UUCP:    chad@ucscb.ucsc.edu    (during school term)
  72.  *    UUCP:    chad@cup.portal.com    (holidays, summer, etc.)
  73.  *    BBS:    BBS-JC, 415/961-7250 (300/1200/2400), "Chad Netzer"
  74.  *
  75.  *    or Dave at:
  76.  *
  77.  *    UUCP:    davids@ucscb.ucsc.edu
  78.  *    BBS:    BBS-JC, "Dave Schreiber"
  79.  *
  80.  *
  81.  *    Building instructions (SAS/C V5.10):
  82.  *
  83.  *          lc -Lcd -v Ruler
  84.  *
  85.  */
  86.  
  87. #include <exec/types.h>
  88. #include <exec/memory.h>
  89. #include <intuition/intuition.h>
  90. #include <intuition/intuitionbase.h>
  91. #include <graphics/gfxbase.h>
  92.  
  93. #define AMIGA_2.0 1    /*Delete if include files for 2.0 or later are*/
  94.             /*not available*/
  95.  
  96. #ifdef AMIGA_2.0
  97.  
  98. #include <utility/tagitem.h>
  99.  
  100. struct TagItem menuTag[] =
  101. {
  102.    {TAG_DONE,NULL}
  103. };
  104.  
  105. #endif
  106.  
  107. #include "GUI.h"
  108.  
  109.    /*Some constants*/
  110. #define HEIGHT titleBarHeight+textHeight-2
  111. #define DEF_HEIGHT 12L+HEIGHT
  112. #define RULER_MARK_Y 11L+HEIGHT
  113. #define OFFSET_START_Y 2L+titleBarHeight
  114. #define BIG_TIC_Y 5L+HEIGHT
  115. #define SMALL_TIC_Y 9L+HEIGHT
  116. #define TEXT_Y 3L+HEIGHT
  117. #define DRAW_AREA_Y 3L+titleBarHeight
  118. #define DRAW_AREA_HEIGHT 24L+textHeight
  119.  
  120. #define NEW(typ)                AllocMem((ULONG)sizeof(typ), MEMF_CLEAR)
  121. #define FREE(p,typ)             FreeMem(p,(ULONG)sizeof(typ))
  122.  
  123. #define ever (;;)       /* used for infinite loops */
  124.  
  125. #define FATAL 20    /* exit code */
  126. #define WARN  10    /* exit code */
  127. #define NORMAL 0    /* exit code */
  128.  
  129. #define LEFT_OFFSET 3L    /* "dead space" on left side of ruler margin */
  130.  
  131. extern void    *OpenLibrary();
  132. extern void    *OpenWindow();
  133. extern void    *GetMsg();
  134. extern void    *AllocMem();
  135. extern void    ReplyMsg();
  136.  
  137. /* Prototypes for functions defined in ruler5.c */
  138. void __regargs release_resources(void);
  139. void __regargs error_exit(char *message);
  140. int  __regargs handleMenu(USHORT NUM);
  141. void __regargs printAboutWindow(void);
  142. void __regargs changeFSize(void);
  143. void __regargs changeScreen(void);
  144. void __regargs readArg(int argc,
  145.          char **argv,
  146.          long *fsize,
  147.          long *w);
  148.  
  149. UWORD        titleBarHeight,textHeight,textWidth,screenWidth;
  150.  
  151. struct NewWindow window_def =
  152. {
  153.     0, 0,              /* Initial LeftEdge, TopEdge */
  154.     241, 17,        /* Default pixel-width, pixel-height */
  155.     0, 1,            /* DetailPen, BlockPen */
  156.     CLOSEWINDOW    |    /* IDCMP flags */
  157.     MENUPICK    |
  158.     NEWSIZE,
  159.     WINDOWDRAG    |    /* window flags */
  160.     WINDOWDEPTH    |
  161.     WINDOWCLOSE    |
  162.     WINDOWSIZING    |
  163.     ACTIVATE    |
  164.     SMART_REFRESH    |
  165.     NOCAREREFRESH,
  166.     NULL,            /* Gadget list */
  167.     NULL,            /* checkmark stuff */
  168.     NULL,            /* window title (to be filled in later) */
  169.     NULL,            /* custom screen pointer */
  170.     NULL,            /* bitmap pointer */
  171.     97 + LEFT_OFFSET, 0,    /* Minwidth, no MinHeight */
  172.     -1, 0,            /* no MaxWidth, MaxHeight */
  173.     CUSTOMSCREEN        /* screen type */
  174. };
  175.  
  176. struct Window        *window;
  177. struct RastPort     *rp;
  178. struct IntuitionBase    *IntuitionBase;
  179. struct GfxBase        *GfxBase;
  180. struct Library        *GadToolsBase;
  181.  
  182. struct Screen        *screen;
  183. struct IntuiMessage    *sys_message;
  184. ULONG            class;
  185. USHORT            code;
  186. int            resource_state;
  187. long    fsize;        /* The font size of ruler scale */
  188.  
  189. APTR            visualInfo;
  190.  
  191. char *version =
  192.     "Text Ruler   V5.00 (CLI)   21-Apr-91  ©1991                                  ";
  193.  
  194. /**********************************************************************/
  195.  
  196. main (argc, argv)
  197.     int    argc;
  198.     char    *argv[];
  199. {
  200.  
  201.     long    fivec;        /* pixel size of five chars    */
  202.     long    w;        /* character width of ruler    */
  203.     long    w_lim;        /* pixel width (w * fsize)      */
  204.     long    x;        /* present window x coordinate    */
  205.     long    y;        /* present window y coordinate    */
  206.  
  207.     char    buf[5];
  208.  
  209.     int    redoWindow;    /*Boolean flag*/
  210.  
  211.     resource_state = 0;
  212.  
  213. /*
  214.  *    Open Intuition and Graphics so we can get screen size and
  215.  *    default font information.
  216.  */
  217.     if((IntuitionBase = OpenLibrary ("intuition.library", NULL))==NULL)
  218.         error_exit("?Cannot open intuition.library\n");
  219.     ++resource_state;
  220.  
  221.     if((GfxBase = OpenLibrary ("graphics.library", NULL))==NULL)
  222.         error_exit("?Cannot open graphics.library\n");
  223.     ++resource_state;
  224.  
  225.     GadToolsBase = OpenLibrary("gadtools.library",NULL);
  226.     if(GadToolsBase)
  227.        window_def.IDCMPFlags|=(ACTIVEWINDOW|INACTIVEWINDOW);
  228.  
  229. /*
  230.  *    Get WorkBench screen information
  231.  */
  232.     screen=window_def.Screen=IntuitionBase->ActiveScreen;
  233.  
  234.     w = 30L;    /* default ruler is 30 chars for a filename */
  235.      /*Get default scale*/
  236.     fsize=textWidth=GfxBase->DefaultFont->tf_XSize;
  237.  
  238. /*
  239.  *    Parse command line to obtain requested parameters.
  240.  */
  241.     readArg(argc,argv,&fsize,&w);
  242.     w_lim = w * fsize;
  243.  
  244. /*
  245.  *    Main loop
  246.  */
  247.  
  248.     for ever
  249.     {
  250.  
  251. /*    Get width of screen
  252.  */
  253.         screenWidth=screen->Width;
  254.  
  255. /*    Determine spacing from current font information
  256.  */
  257.         titleBarHeight = screen->Font->ta_YSize;
  258.         textHeight = GfxBase->DefaultFont->tf_YSize;
  259.  
  260. /*
  261.  *    Now calculate window sizing and placement parameters and setup title.
  262.  */
  263.         window_def.Width    = w_lim + LEFT_OFFSET + 1;
  264.         window_def.Height    = DEF_HEIGHT;
  265.         window_def.Title    = (UBYTE *)version;
  266. /*
  267.  *    Shorten the window if it would be wider than the screen
  268.  */
  269.         if (window_def.Width > screenWidth )
  270.         {
  271.            window_def.Width = screenWidth;
  272.            w_lim = (window_def.Width) - 1 - LEFT_OFFSET;
  273.         }
  274.  
  275. /*
  276.  *    Open the ruler display window.
  277.  */
  278.         window = OpenWindow (&window_def);
  279.  
  280.         if (window == NULL)
  281.         {
  282.         error_exit("?Cannot open window\n");
  283.         }
  284.         ++resource_state;
  285.  
  286. /*
  287.  *    Set screen and window titles
  288.  */
  289.         SetWindowTitles(window,version,"Text Ruler V5.00");
  290.  
  291. /*
  292.  *    If running under 2.0 or later, adjust menu spacing information
  293.  *    to compensate for a non-8 point font size.
  294.  */
  295.         if(GadToolsBase != NULL)
  296.         {
  297.            visualInfo = (APTR)GetVisualInfoA(screen,menuTag);
  298.            LayoutMenusA(&Menu1,visualInfo,menuTag);
  299.            FreeVisualInfo(visualInfo);
  300.         }
  301.  
  302. /*
  303.  *    Install menus
  304.  */
  305.         SetMenuStrip(window,&Menu1);
  306. /*
  307.  *    Get pointer to raster port.
  308.  */
  309.         rp = window -> RPort;
  310.  
  311. /*
  312.  *    Inner loop (loop until the window needs to be closed and another
  313.  *    opened).
  314.  */
  315.         redoWindow=FALSE;
  316.  
  317.         while(!redoWindow)
  318.         {
  319.         redoWindow=FALSE;
  320.         fivec        = 5L * fsize;
  321. /*
  322.  *    Use RectFill to blank the window area and set pen for drawing.
  323.  */
  324.         SetAPen(rp, NULL);
  325.         RectFill(rp, LEFT_OFFSET+1, DRAW_AREA_Y, w_lim + LEFT_OFFSET,
  326.               DRAW_AREA_Y+DRAW_AREA_HEIGHT);
  327.  
  328. /*
  329.  *    Now set pen to draw.
  330.  */
  331.         SetAPen(rp, 1L);
  332. /*
  333.  *    When I use the ruler, I like to jam it up against the left hand side of
  334.  *    my workbench screen, so that it to measure something on the CLI.
  335.  *    However, the CLI is offset by a small amount, so I compensate by
  336.  *    starting the "virtual" area of the ruler a little to the right...
  337.  *
  338.  *    Fill in the offset area that is unused.
  339.  */
  340.  
  341.         RectFill(rp, NULL, OFFSET_START_Y, LEFT_OFFSET,
  342.             DRAW_AREA_Y+DRAW_AREA_HEIGHT+1);
  343.  
  344. /*
  345.  *    Draw ruler and text
  346.  */
  347.         for (x = NULL; x < (w_lim + fsize); x += fsize)
  348.         {
  349.             /*big tic every 5 chars*/
  350.             if ((x % fivec) == NULL)  y = BIG_TIC_Y;
  351.             else y = SMALL_TIC_Y;     /* small tic every char  */
  352.             Move (rp, x + LEFT_OFFSET, y);
  353.             Draw (rp, x + LEFT_OFFSET, RULER_MARK_Y);
  354. /*
  355.  *    Label ruler.
  356.  *    The test for position `fivec' (in the Move()) is for centering ``5''
  357.  *    differently than the centering for two-digit numbers.
  358.  */
  359.             if ((x > NULL) && (x < w_lim) && ((x % fivec) == NULL))
  360.             {
  361.             stci_d(buf,x/fsize);
  362.             Move (rp, (x == fivec)
  363.                ? (x - textWidth + (textWidth/2) + LEFT_OFFSET)
  364.                : (x -  textWidth + LEFT_OFFSET),
  365.                TEXT_Y);
  366.             Text (rp, buf, (long) strlen (buf));
  367.             }
  368.         }
  369.  
  370.         SetAPen(rp,1);
  371.         Move(rp,w_lim+LEFT_OFFSET,titleBarHeight);
  372.         Draw(rp,w_lim+LEFT_OFFSET,DEF_HEIGHT);
  373.  
  374. /*
  375.  *    Wait for gadget activation.  No busy-/spin-/wait-loops here!
  376.  */
  377.         Wait (1L << window -> UserPort -> mp_SigBit);
  378. /*
  379.  *    Retrieve LAST message in Message Port
  380.  */
  381.         sys_message = GetMsg(window -> UserPort);
  382.         class = sys_message -> Class;
  383.         code = sys_message -> Code;
  384.         ReplyMsg(sys_message);
  385. /*
  386.  *    Dump uneeded messages (respond only to the last on LIFO queue).
  387.  */
  388.         while (sys_message = GetMsg(window -> UserPort))
  389.         {
  390.             ReplyMsg(sys_message);
  391.         }
  392.  
  393.              /*Handle various IDCMP events*/
  394.         switch(class)
  395.         {
  396.             case CLOSEWINDOW:
  397.             release_resources();
  398.             exit (NORMAL);
  399.  
  400.             case NEWSIZE:
  401.             w_lim = (window -> Width) - 1 - LEFT_OFFSET;
  402.             break;
  403.  
  404.             case INACTIVEWINDOW:
  405.             SetWindowTitles(window,version,"Text Ruler V5.00");
  406.             break;
  407.  
  408.             case MENUPICK:
  409.             redoWindow=handleMenu(code);
  410.         }
  411.         }
  412.     }
  413. }
  414.  
  415. /**********************************************************************
  416.  *
  417.  *    cleanup routine
  418.  *
  419.  *    The ``switch'' on resource_state is to assure we don't attempt to
  420.  *    free something we don't have.  Items are released in the reverse
  421.  *    order they were obtained (by "falling thru" the cases).
  422.  */
  423. void __regargs release_resources()
  424. {
  425.     switch (resource_state)
  426.     {
  427.         case 3: ClearMenuStrip(window);
  428.             CloseWindow (window);
  429.         case 2: CloseLibrary(GfxBase);
  430.         case 1: CloseLibrary(IntuitionBase);
  431.     }
  432.     if(GadToolsBase != NULL)
  433.        CloseLibrary(GadToolsBase);
  434. }
  435.  
  436. /**********************************************************************
  437.  *
  438.  *    error handler
  439.  */
  440. void __regargs error_exit(message)
  441.     char    *message;
  442. {
  443.     if (message == NULL)
  444.     {
  445.         puts("Internal failure, exiting gracefully...\n");
  446.     }
  447.     else
  448.     {
  449.         puts(message);
  450.     }
  451.     release_resources();
  452.     exit (FATAL);
  453. }
  454.  
  455. /*
  456.  *    Decode menu choice
  457.  */
  458.  
  459. int __regargs handleMenu(USHORT NUM)
  460. {
  461.    struct MenuItem *item;
  462.    USHORT menuNum,itemNum;
  463.  
  464.    while(NUM != MENUNULL)
  465.    {
  466.       menuNum=MENUNUM(NUM);
  467.       itemNum=ITEMNUM(NUM);
  468.       item=(struct MenuItem *)ItemAddress(&Menu1,NUM);
  469.  
  470.       if(menuNum==0)
  471.      if(itemNum==0)
  472.         printAboutWindow();     /*About*/
  473.      else
  474.      {
  475.         release_resources();    /*Quit*/
  476.         exit(NORMAL);
  477.      }
  478.       else
  479.      if(itemNum==0)
  480.      {
  481.         changeFSize();          /*Change Scale*/
  482.         return(FALSE);
  483.      }
  484.      else
  485.      {
  486.         changeScreen();         /*Change Screen*/
  487.         return(TRUE);
  488.      }
  489.  
  490.       NUM=item->NextSelect;
  491.    }
  492.    return(0);
  493. }
  494.  
  495. /*
  496.  *    Display the About window
  497.  */
  498. void __regargs printAboutWindow()
  499. {
  500.    struct Window *aboutWdw;
  501.  
  502.    if((NewAboutWindow.LeftEdge=(screenWidth-NewAboutWindow.Width)/2) > 200)
  503.       NewAboutWindow.LeftEdge = 200;
  504.  
  505. /*
  506.  *    Determine About window position
  507.  */
  508.    NewAboutWindow.TopEdge=(screen->Height-NewAboutWindow.Height)/5;
  509.    NewAboutWindow.Height=titleBarHeight-15+ABOUT_WDW_HEIGHT;
  510.  
  511. /*
  512.  *    Get the screen the about window will appear on (same as the
  513.  *    screen the main window is on).
  514.  */
  515.    NewAboutWindow.Screen = (struct Screen *) screen;
  516.  
  517. /*
  518.  *    Open window
  519.  */
  520.  
  521.    aboutWdw=(struct Window *)OpenWindow(&NewAboutWindow);
  522.    if(aboutWdw==NULL)
  523.       return;
  524.  
  525. /*
  526.  *    Print window text
  527.  */
  528.  
  529.    PrintIText(aboutWdw->RPort,&IText11,0,titleBarHeight-15);
  530.  
  531. /*
  532.  *    Wait for input close gadget to be pressed, then close window and
  533.  *    return.
  534.  */
  535.    Wait(1<<aboutWdw->UserPort->mp_SigBit);
  536.  
  537.    CloseWindow(aboutWdw);
  538.    return;
  539. }
  540.  
  541. /*
  542.  *    Change scale
  543.  */
  544. void __regargs changeFSize()
  545. {
  546.    ULONG IDCMPFlags;
  547.  
  548.    IDCMPFlags=window_def.IDCMPFlags;
  549.    ModifyIDCMP(window,INACTIVEWINDOW);
  550.  
  551.    for ever
  552.    {
  553.        /*Wait for IDCMP event*/
  554.        Wait (1L << window -> UserPort -> mp_SigBit);
  555.        sys_message = GetMsg(window -> UserPort);
  556.        class = sys_message -> Class;
  557.        ReplyMsg(sys_message);
  558.  
  559. /*
  560.  *     If another window was clicked, get the horizontal font size of
  561.  *     the current font in that window
  562.  */
  563.  
  564.        if(class==INACTIVEWINDOW)
  565.        {
  566.      if((IntuitionBase->ActiveWindow->RPort->Font->tf_Flags & FPF_PROPORTIONAL) == 0)
  567.         fsize=IntuitionBase->ActiveWindow->RPort->Font->tf_XSize;
  568.      else
  569.      {
  570.         /*If the window is using a proportional font, print an error*/
  571.         SetWindowTitles(window,version,"Can't change scale:  window font is proportional.");
  572.         DisplayBeep(window->WScreen);
  573.      }
  574.      ModifyIDCMP(window,IDCMPFlags);
  575.      return;
  576.        }
  577.    }
  578. }
  579.  
  580. /*
  581.  *    Change the screen that the window is displayed on.
  582.  */
  583.  
  584. void __regargs changeScreen()
  585. {
  586.    for ever
  587.    {
  588. /*
  589.  *    Wait for user to click on another window (hopefully in another
  590.  *    screen).
  591.  */
  592.        ModifyIDCMP(window,INACTIVEWINDOW);
  593.        Wait (1L << window -> UserPort -> mp_SigBit);
  594.        sys_message = GetMsg(window -> UserPort);
  595.        class = sys_message -> Class;
  596.        ReplyMsg(sys_message);
  597.        if(class==INACTIVEWINDOW)
  598.        {
  599.      /*Get active screen*/
  600.      window_def.Screen=screen=IntuitionBase->ActiveScreen;
  601.  
  602.      /*Clear menu strip and close window*/
  603.      ClearMenuStrip(window);
  604.      CloseWindow(window);
  605.      resource_state--;
  606.  
  607.      return;
  608.        }
  609.    }
  610. }
  611.  
  612. /*
  613.  *    Read command line arguments, print help if requested
  614.  */
  615.  
  616. void __regargs readArg(int argc, char *argv[], long *fsize, long *w)
  617. {
  618.    int argCounter;
  619.    BYTE gotSize = FALSE;
  620.  
  621.    if(argc > 1 && argv[1][0]=='?')
  622.    {
  623. /*
  624.  *    Print help and exit
  625.  */
  626.       puts("");
  627.       puts("Text Ruler V5.00 ©1991 by Thad Floryan, Chad Netzer, and Dave Schreiber.");
  628.       puts("");
  629.       puts("Usage:  Ruler5 [-z<size>][-s<scale>]");
  630.       puts("   <size>  - Number of 'ticks'");
  631.       puts("   <scale> - Width between ruler 'ticks', in pixels.");
  632.       puts("or: Ruler5 [<size> [<scale>]]");
  633.       release_resources();
  634.       exit(0);
  635.    }
  636.  
  637. /*
  638.  *    Otherwise, examine each argument
  639.  */
  640.    for(argCounter=1;argCounter < argc ; argCounter++)
  641.    {
  642.       if(isdigit(argv[argCounter][0])) /*Check if just a digit*/
  643.      if(!gotSize)
  644.      {
  645.         gotSize=TRUE;
  646.         *w=atol(argv[argCounter]);
  647.      }
  648.      else
  649.         *fsize=atol(argv[argCounter]);
  650.       else
  651.       {
  652.      if(argv[argCounter][0] != '-')
  653.      {
  654.         puts("I don't understand this argument:");
  655.         puts(argv[argCounter]);
  656.         error_exit("");
  657.      }
  658.      switch(argv[argCounter][1])
  659.      {
  660.            /*Each case checks for to see if there's a space between*/
  661.            /*the switch and the argument*/
  662.         case 's':   /*Scale*/
  663.         case 'S':
  664.            if(argv[argCounter][2]!=NULL)
  665.           *fsize=atol(&argv[argCounter][2]);
  666.            else
  667.           *fsize=atol(&argv[++argCounter][0]);
  668.         if(*fsize < 5)
  669.           error_exit("The scale must be at least 5");
  670.            if(*fsize > 50)
  671.           error_exit("The scale must be at most 50");
  672.            break;
  673.  
  674.         case 'z':   /*Size*/
  675.         case 'Z':
  676.            if(argv[argCounter][2]!=NULL)
  677.           *w=atol(&argv[argCounter][2]);
  678.            else
  679.           *w=atol(&argv[++argCounter][0]);
  680.            if(*w < 12)
  681.           error_exit("The size must be at least 12");
  682.            break;
  683.      }
  684.       }
  685.    }
  686.    return;
  687. }
  688.  
  689.